<ion-header>
    <ion-navbar no-border-bottom>
        <ion-title>{{title[type]}}</ion-title>
    </ion-navbar>
</ion-header>
<ion-content class='authorization'>
    <ion-list class='gfoa-list'>
        <ion-item>
            <ion-row>
                <ion-col width-33 class='title'>授权人:</ion-col>
                <ion-col width-67 text-right class='substance'>{{item.empidName}}</ion-col>
            </ion-row>
        </ion-item>
        <ion-item *ngIf="isDetail == false">
            <ion-row>
                <ion-col width-33 class='title'>授权给:</ion-col>
                <ion-col text-rigth class='substance'>
                    <div class="selected-user-list-item">{{item.authorizedName}}
                    </div>
                </ion-col>
                <ion-col width-20 class="operate" *ngIf="isDetail == false">
                    <button ion-button small (click)="chooseEmp()" [disabled]="isDetail">选择</button>
                </ion-col>
            </ion-row>
        </ion-item>
        <ion-item *ngIf="isDetail">
            <ion-row>
                <ion-col width-33 class='title'>授权给:</ion-col>
                <ion-col width-67 text-right class='substance'>{{item.authorizedName}}</ion-col>
            </ion-row>
        </ion-item>

        <ion-item *ngIf="isDetail == false">
            <!-- 启用/STAR,未启用/STOP,删除/DELE -->
            <ion-label>授权状态:</ion-label>
            <ion-select [(ngModel)]="item.stat" okText="完成" cancelText="取消" [disabled]="isDetail">
                <ion-option value="STAR">启用</ion-option>
                <ion-option value="STOP">暂停</ion-option>
            </ion-select>
        </ion-item>
        <ion-item *ngIf="isDetail">
            <ion-row>
                <ion-col width-33 class='title'>授权状态:</ion-col>
                <ion-col width-67 text-right class='substance'>{{item.stat == "STAR" ? "启用" : (item.stat == "STOP" ? "暂停" : "删除")}}</ion-col>
            </ion-row>
        </ion-item>
        <ion-item *ngIf="isDetail == false">
            <ion-label>开始日期:</ion-label>
            <ion-datetime displayFormat="YYYY-MM-DD" pickerFormat="YYYY-MM-DD" [(ngModel)]="sdate" cancelText="取消" doneText="确定" max="2099" [disabled]="isDetail" (ionChange)="ionChange()"></ion-datetime>
        </ion-item>
         <ion-item *ngIf="isDetail == false">
            <ion-label>开始时间:</ion-label>
            <ion-datetime displayFormat="HH:mm:ss" pickerFormat="HH:mm:ss" [(ngModel)]="sdateTime" cancelText="取消" doneText="确定" [disabled]="isDetail" (ionChange)="ionChange()"></ion-datetime>
        </ion-item>
        <ion-item *ngIf="isDetail">
            <ion-row>
                <ion-col width-33 class='title'>开始时间:</ion-col>
                <ion-col width-67 text-right class='substance'>{{item.sdate}}</ion-col>
            </ion-row>
        </ion-item>
        <ion-item *ngIf="isDetail == false">
            <ion-label>结束日期:</ion-label>
            <ion-datetime displayFormat="YYYY-MM-DD" pickerFormat="YYYY-MM-DD" [(ngModel)]="edate" cancelText="取消" doneText="确定" max="2099" [disabled]="isDetail" (ionChange)="ionChange()"></ion-datetime>
        </ion-item>
         <ion-item *ngIf="isDetail == false">
            <ion-label>结束时间:</ion-label>
            <ion-datetime displayFormat="HH:mm:ss" pickerFormat="HH:mm:ss" [(ngModel)]="edateTime" cancelText="取消" doneText="确定" [disabled]="isDetail" (ionChange)="ionChange()"></ion-datetime>
        </ion-item>
        <ion-item *ngIf="isDetail">
            <ion-row>
                <ion-col width-33 class='title'>开始时间:</ion-col>
                <ion-col width-67 text-right class='substance'>{{item.edate}}</ion-col>
            </ion-row>
        </ion-item>
        <ion-item *ngIf="isDetail == false">
            <!-- 启用/STAR,未启用/STOP,删除/DELE -->
            <ion-label>授权类型:</ion-label>
            <ion-select [(ngModel)]="item.type" okText="完成" cancelText="取消" [disabled]="isDetail">
                <ion-option value="ALL">全部子系统</ion-option>
                <ion-option value="MODU">部分子系统</ion-option>
            </ion-select>
        </ion-item>
        <ion-item *ngIf="isDetail">
            <ion-row>
                <ion-col width-33 class='title'>授权类型:</ion-col>
                <ion-col width-67 text-right class='substance'>{{item.type =="ALL"? "全部子系统":"部分子系统"}}</ion-col>
            </ion-row>
        </ion-item>
<!--         <ion-item>
            <ion-row>
                <ion-col width-33 class='title'>授权子系统:</ion-col>
                <ion-col width-67 text-right class='substance'>{{item.moduleName}}</ion-col>
            </ion-row>
        </ion-item> -->
         <ion-item *ngIf="isDetail == false && item.type!='ALL'">
            <ion-row>
                <ion-col width-33 class='title'>授权子系统:</ion-col>
                <ion-col class='substance'>
                    <div class="selected-user-list-item">{{item.moduleName}}
                    </div>
                </ion-col>
                <ion-col width-20 class="operate" *ngIf="isDetail == false">
                    <button ion-button small (click)="chooseSys()" [disabled]="isDetail">选择</button>
                </ion-col>
            </ion-row>
        </ion-item>
        <ion-item *ngIf="isDetail && item.type!='ALL'">
            <ion-row>
                <ion-col width-33 class='title'>授权子系统:</ion-col>
                <ion-col width-67 class='substance'>{{item.moduleName}}</ion-col>
            </ion-row>
        </ion-item>
    </ion-list>
    <ion-row *ngIf="type=='add'">
        <ion-col text-center>
            <button ion-button color="light" (click)="submit('insert')">保存</button>
        </ion-col>
        <ion-col text-center>
            <button ion-button color="light" (click)="cancle('add')">取消</button>
        </ion-col>
    </ion-row>
    <ion-row *ngIf="type =='update'">
        <ion-col text-center>
            <button ion-button color="light" (click)="submit('save')">保存</button>
        </ion-col>
        <ion-col text-center>
            <button ion-button color="light" (click)="cancle('update')">取消</button>
        </ion-col>
    </ion-row>
    <ion-row *ngIf="type =='detail'">
        <ion-col text-center>
            <!-- 跳转到编辑页面 -->
            <button ion-button color="light" (click)="edit()">编辑</button>
        </ion-col>
        <ion-col text-center>
            <button ion-button color="light" (click)="delete()">删除</button>
        </ion-col>
    </ion-row>
</ion-content>
